package com.sim.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.sim.util.SessionContext;

public class User {
	private Long id;
    private String loginName;//登录名
	private String name;//用户姓名
	private Date registerTime;//注册时间
	private String role;//用户角色
	private Long gender;//性别
	private String phoneNumber;//电话号码
	private String email;//邮箱
	private String password;//密码
	private Set<Society> societies = new HashSet<Society>();//社团
	private Set<PsychologicalHealth> psychologicalHealthes = new HashSet<PsychologicalHealth>();
	private Set<Subsidize> subsidizes = new HashSet<Subsidize>();//资助
	public boolean checkWatch(Long id){
		boolean flag = false;
		User user = SessionContext.get();
		if(id.equals(user.getId())){
			flag = true;
		}
		System.out.println("user.getId():"+id+flag+user.getId());
		return flag;
	}
	/**
	 * 查看是否已经关注
	 * @param id
	 * @return
	 */
	public boolean checkWatch(Set<User> userSet){
		boolean flag = false;
		User user = SessionContext.get();
		/*if(id.equals(user.getId())){
			flag = true;
		}*/
		List<User> userList = new ArrayList<User>(userSet);
		for(User usernew:userList){
			if(user.getId().equals(usernew.getId())){
				flag=true;
			}
		}
		
		return flag;
	}
	/**
	 * 查看是否没关注
	 * @param id
	 * @return
	 */
	public boolean checkUnWatch(Long id){
		boolean flag = false;
		User user = SessionContext.get();
		if(!id.equals(user.getId())){
			flag = true;
		}
		
		return flag;
	}
	/**
     * 判断是否为男性
     * @return
     */
	public boolean isMan(String gender){
		if("男".equals(gender)){
			return true;
		}		 
		return false;
	}
   /**
    * 判断是否为女性
    * @return
    */
	public boolean isWoman(String gender){
		if("女".equals(gender)){
			return true;
		}		 
		return false;
	}
   /**
    * 判断是否为保密
    * @return
    */
	public boolean isSecret(String gender){
		if("保密".equals(gender)){
			return true;
		}		 
		return false;
	}
	//===================================
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Date getRegisterTime() {
		return registerTime;
	}
	public void setRegisterTime(Date registerTime) {
		this.registerTime = registerTime;
	}
	public String getRole() {
		return role;
	}
	public void setRole(String role) {
		this.role = role;
	}
	
	public Long getGender() {
		return gender;
	}
	public void setGender(Long gender) {
		this.gender = gender;
	}
	public String getPhoneNumber() {
		return phoneNumber;
	}
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public Set<Society> getSocieties() {
		return societies;
	}
	public void setSocieties(Set<Society> societies) {
		this.societies = societies;
	}
	public Set<PsychologicalHealth> getPsychologicalHealthes() {
		return psychologicalHealthes;
	}
	public void setPsychologicalHealthes(
			Set<PsychologicalHealth> psychologicalHealthes) {
		this.psychologicalHealthes = psychologicalHealthes;
	}
	public Set<Subsidize> getSubsidizes() {
		return subsidizes;
	}
	public void setSubsidizes(Set<Subsidize> subsidizes) {
		this.subsidizes = subsidizes;
	}
	
}
